package com.eshop.pcresult;

import java.util.HashMap;
import java.util.Map;

public class CoReturnFormat
{
    public static Map<String, String> messageMap;
    public static final String SUCCESS = "200";
    public static final String REPEAT_REQUEST = "00001";
    public static final String NOT_FILE = "00002";
    public static final String TOKEN_IS_NULL = "20003";
    public static final String TOKEN_APPROVE_ERROR = "20004";
    public static final String USER_NOT_LOGIN = "20005";
    public static final String USER_LOGIN = "20006";
    public static final String USERNAME_OR_PHONE_HAVE = "20007";
    public static final String SYS_ERROR = "99999";
    public static final String SYS_HINT = "8888";
    public static final String SYS_RUNTIME_ERROR = "10000";
    public static final String SYS_NULL_ERROR = "10001";
    public static final String SYS_CONVERT_ERROR = "10002";
    public static final String SYS_IO_ERROR = "10003";
    public static final String SYS_METHOD_UNKNOWN = "10004";
    public static final String SYS_ARRAY_OUT_INDEX = "10005";
    public static final String SYS_NET_ERROR = "10006";
    public static final String SYS_TOKEN_AUTH_FAILED = "10007";
    public static final String SYS_TOKEN_TIMEOUT = "10008";
    public static final String SYS_TOKEN_NO_PARAM = "10009";
    public static final String SYS_DATE_PARSE_EXCEPTION = "10010";
    public static final String PARAM_MISSING = "11001";
    public static final String PARAM_INVALID = "11002";
    public static final String PARAM_MISSING_ID = "11003";
    public static final String LOGIC_ERROR_DATABASE = "11004";
    public static final String CODE_ERROR = "11005";
    public static final String OLD_PASSWORD_ERROR = "11006";
    public static final String USER_UNREGISTER = "21001";
    public static final String USER_AREADY_REGISTER = "21002";
    public static final String USER_OR_PASSWD_ERROR = "21003";
    public static final String USER_DELETE = "21004";
    public static final String USER_TYPE_STOP = "21005";
    public static final String USER_LEAVE = "21006";
    public static final String START_USER = "21007";
    public static final String STOP_USER = "21008";
    public static final String HAVE_STOP_USER = "21009";
    public static final String PHONE_ALREADY_BUSINESS = "21010";
    public static final String PHONE_ALREADY_SYS = "21011";
    public static final String USER_CHECK_ERROR = "21012";
    public static final String PASSWORD_NOT_AGREEN = "21013";
    public static final String WECHAT_ERROR = "21014";
    public static final String HAVE_BLACK = "21015";
    public static final String BANK_ALREADY = "21016";
    public static final String ALI_APPLET_AUTH_ERROR = "21017";
    public static final String VERIFY_PHONE_ERROR = "21018";
    public static final String OTHER_ALI_USER_BIND_PHONE = "21019";
    public static final String SORT_ALREADY = "30001";
    public static final String DICT_NAME_ALREADY = "30002";
    public static final String DICT_NOT_OPERATION = "30003";
    public static final String DEMON_ACCOUNT_NOT_PERMITTED = "30004";
    public static final String ALIPAY_QRCODE_INSUF_PER = "30005";
    public static final String SHOP_NAME_ALREADY = "40001";
    public static final String SHOP_PHONE_ALREADY = "40002";
    public static final String CLASSIFY_BOND_PRODUCT = "40003";
    public static final String RULE_NOT_SMALLER = "40004";
    public static final String SHOP_CHECK_STAY = "40005";
    public static final String SHOP_CHECK_STOP = "40006";
    public static final String PHONE_ALREADY = "40007";
    public static final String CROWD_NAME_ALREADY = "40008";
    public static final String GROUP_WORK_NOT_STOP = "40009";
    public static final String PHONE_ALREADY_WX = "40010";
    public static final String MERCHANT_NOT_EXIST = "40011";
    public static final String PHONE_ALREADY_BIND_SHOP = "40012";
    public static final String PHONE_NOT_BANK_SHOP = "40013";
    public static final String SHOP_CHECK_TIME_OVERDUE = "40014";
    public static final String ACTIVITY_TIME_ERROR = "50001";
    public static final String ACTIVITY_TIME_CROSS = "50002";
    public static final String ACTIVITY_PRODUCT_REPEAT = "50003";
    public static final String PARAM_NUMBER_NOT_NULL = "50004";
    public static final String HAVE_ONE_TOOL_PRODUCT = "50005";
    public static final String NOT_EXPRESS_FORMID = "60001";
    public static final String NOT_RESULT = "60002";
    public static final String BUSINESS_BALANCE_NOT = "70001";
    public static final String OPENID_IS_NULL = "70002";
    public static final String PAY_MONEY_NOT_ZERO = "70003";
    public static final String APPLY_REFUND_FAILED = "70004";
    public static final String GENERATE_COLLECTION_CODE_FAILED = "70005";
    public static final String PAY_ORDER_ERROR = "700006";
    public static final String PRODUCT_STOCK_ERROR = "80001";
    public static final String HAVE_INVALID_PRODUCT = "80002";
    public static final String SENSITIVE_ERROR = "80003";
    public static final String CLASSIFY_NAME_NULL = "80004";
    public static final String PRODUCT_LIMIT_ERROR = "80005";
    public static final String PRODUCT_WITH_ACTIVITY = "80006";
    public static final String DISTRIBUTO_NOT_RELATIONSHIP = "90001";
    public static final String RELATION_TIME_ERROR = "90002";
    public static final String DISTRIBUTOR_PHONE_ALREADY_ADD = "90003";
    public static final String DISTRIBUTOR_NOT_SELF = "90004";
    public static final String USER_NOT_BUYER = "90005";
    public static final String USER_ALREADY_STOP = "90006";
    public static final String USER_ALREADY_BLACK = "90007";
    public static final String NOT_HAVE_DISTRIBUTOR_LEVEL = "90008";
    public static final String NOT_ROBBING = "90009";
    public static final String PHONE_NOT_DISTRIBUTOR = "90010";
    public static final String LEVEL_EXISTS = "90011";
    public static final String DISTRIBUTOR_ERROR = "90012";
    public static final String MP4_FILE_NOT_2M = "100001";
    public static final String KEY_WORD_ALREADY = "200001";
    public static final String AFTER_NOT_RETURN = "300001";
    public static final String ORDER_NOT_TAKE = "400001";
    public static final String BALANCE_NOT_ENOUGH = "500001";
    public static final String COLLAGE_ALREADY_SUCCESS = "600001";
    public static final String PRODUCT_ALREADY_SELL_OUT = "600002";
    public static final String COUPON_RECEIVE_FINISH = "700001";
    public static final String HAVE_STAY_OPERATE = "700002";
    public static final String COUPON_TAKE_UPPER_LIMIT = "700003";
    public static final String COUPON_ALREADY_HAVE = "700004";
    public static final String CANVAS_ALREADY = "800001";
    public static final String SYNC_MENU_ING = "800002";
    
    public static String getMessage(final String code) {
        final String message = code;
        final String obj = CoReturnFormat.messageMap.get(code);
        return (obj == null) ? message : obj;
    }
    
    public static void putAll(final Map<String, String> m) {
        CoReturnFormat.messageMap.putAll(m);
    }
    
    public static void put(final String key, final String value) {
        if (isEmpty(key) || isEmpty(value)) {
            return;
        }
        CoReturnFormat.messageMap.put(key, value);
    }
    
    public static boolean isEmpty(final String str) {
        return null == str || str.trim().length() == 0;
    }
    
    static {
        CoReturnFormat.messageMap = new HashMap<String, String>();
        put("00000", "success");
        put("400", "Bad Request!");
        put("401", "NotAuthorization");
        put("405", "Method Not Allowed");
        put("406", "Not Acceptable");
        put("500", "Internal Server Error");
        put("99999", "系统开小差,请稍后再试!");
        put("99999", "系统异常,请联系管理员!");
        put("200", "成功");
        put("00001", "重复请求,请稍后再试");
        put("00002", "文件为空,请重新选择文件");
        put("20003", "token为空");
        put("20004", "token认证失败");
        put("20005", "请先登录");
        put("20006", "用户已登录");
        put("20007", "该用户名或手机号已注册");
        put("10000", "[服务器]运行时异常");
        put("10001", "[服务器]空值异常");
        put("10002", "[服务器]数据类型转换异常");
        put("10003", "[服务器]IO异常");
        put("10004", "[服务器]未知方法异常");
        put("10005", "[服务器]数组越界异常");
        put("10006", "[服务器]网络异常");
        put("10007", "[服务器]Token认证失败");
        put("10008", "[服务器] Token 失效");
        put("10009", "[服务器] Token参数缺失");
        put("10010", "[服务器] 日期格式解析异常");
        put("11005", "验证码有误");
        put("11001", "必填参数不能为空");
        put("11002", "参数不合法");
        put("11003", "参数ID缺失");
        put("11004", "[逻辑错误]数据库数据异常");
        put("21001", "用户未注册");
        put("21002", "用户已注册");
        put("21003", "用户名或密码错误");
        put("21004", "用户已删除");
        put("8888", "系统提示信息  ");
        put("21005", "账户已停用");
        put("21006", "账户已离职");
        put("21007", "启用状态下的员工才能停用");
        put("21008", "停用状态下的员工才能启用");
        put("21009", "存在停用的账号无法进行该操作");
        put("11006", "原密码错误");
        put("21010", "该手机号已绑定商户,无法注册");
        put("21011", "该手机已绑定内部账号,无法注册");
        put("21012", "用户校验失败,请重试");
        put("21013", "两次输入不一致");
        put("21014", "微信授权失败,请重试");
        put("21015", "您已被拉入黑名单");
        put("21016", "银行卡已重复");
        put("21017", "支付宝小程序授权失败");
        put("21018", "验证手机号失败");
        put("21019", "该手机号已被其他支付宝账户绑定");
        put("30001", "排序值已存在,请修改后重试");
        put("30002", "字典名称已存在,请修改后重试");
        put("30003", "初始化字典数据无法进行该操作");
        put("30004", "演示账号不允许修改数据");
        put("30005", "该商户尚未开通支付宝小程序二维码权限");
        put("40001", "商家名称已存在");
        put("40002", "手机号已被注册");
        put("40003", "商品类别已绑定商品数据,无法删除");
        put("40004", "填写内容不能小于上一级内容");
        put("40005", "入住申请审核中");
        put("40006", "入住申请已被拒绝");
        put("40007", "该手机号客户已存在");
        put("40008", "该人群名称已存在");
        put("40009", "拼团活动正在进行中,请勿停止");
        put("40010", "该手机号已绑定其他微信用户");
        put("40011", "商家不存在");
        put("40012", "手机号已绑定店铺");
        put("40013", "手机号与店铺绑定手机号不一致,请修改后重试");
        put("40014", "不能选择以往日期,入驻时间直接过期");
        put("50001", "活动开始时间必须大于报名结束时间");
        put("50002", "活动起始时间存在交叉,请修改后重试");
        put("50003", "存在重复参与活动商品,请仔细排查后重试");
        put("50004", "限制数量不能为空");
        put("50005", "至少要有一个活动商品");
        put("60001", "无法识别快递单号");
        put("60002", "查询无结果，请隔段时间再查");
        put("70001", "商户可用退款余额不足");
        put("70002", "客户未绑定微信,无法使用微信支付");
        put("70003", "支付金额不能为0");
        put("70004", "退款申请失败");
        put("70005", "生成收款码失败");
        put("700006", "订单预支付失败");
        put("80001", "商品已不可售，看看其他的吧");
        put("80002", "存在无效商品，请重新选择");
        put("80003", "你的内容存在敏感词，请重新编辑后再次发布");
        put("80004", "请输入分类名称");
        put("80005", "已超出最大限制购买数量");
        put("80006", "商品已关联活动数据,无法删除");
        put("90001", "分销员之间不允许建立关系");
        put("90002", "保护期时间需要小于有效期");
        put("90003", "该手机号已经添加过分销员");
        put("90004", "邀请人不能是自己");
        put("90005", "该用户未注册成买家");
        put("90006", "该用户已停用");
        put("90007", "该用户已被拉入黑名单");
        put("90008", "未设置分销员等级");
        put("90009", "当前关系设置不允许抢客");
        put("90010", "手机号已申请过分销员");
        put("90011", "已存在相同编号的分销员等级");
        put("90012", "申请失败");
        put("100001", "视频文件不能超过2M");
        put("200001", "关键词已存在");
        put("300001", "该售后单状态已变更,无法进行该操作");
        put("400001", "该订单状态已变更,无法进行该操作");
        put("500001", "可提现余额不足,无法提现");
        put("600001", "该拼单已成团,订单已自动取消");
        put("600002", "活动商品已售罄,可以选择其他商品抢购");
        put("700001", "优惠券已领完");
        put("700002", "存在进行中的运营计划,无法删除");
        put("700003", "优惠券领取已达最大限制次数,无法继续领取");
        put("700004", "该优惠券已领取,请勿重复领取");
        put("800001", "该类型画布已存在,请修改");
        put("800002", "后台已有菜单在同步中，请稍后再试");
    }
}
